<?php

define('DB_SERVER','mysql2.alwaysdata.com', true); // ADRESSE DU SERVEUR DE BASE DE DONN�ES

    define('DB_LOGIN','60641_toscan', true); // LOGIN

    define('DB_PASSWORD', 'motdepasse', true); // MOT DE PASSE // MAMP -> DB_PASSWORD= 'root'

    define('DB_NAME','testtoscan_test', true); // NOM DE LA BASE DE DONN�ES

    define('DB_DRIVER', 'mysql:host=' . DB_SERVER . ';dbname=' . DB_NAME, true); // PREMIER PARAMETRE A SAISIR LORS DE LA CREATION D'UN OBJET PDO

    mysql_query('SET NAMES UTF8');

  function model_db_connexion($host = DB_DRIVER, $data_base = DB_NAME, $user = DB_LOGIN, $password = DB_PASSWORD) {
        try {
            $bdd = new PDO('mysql:host:=' . $host . ';dbname:=' . $data_base, $user, $password);

            return $bdd;
        } catch (PDOException $e) {
            print "Erreur !: " . $e->getMessage() . "<br/>";
            die();
        }
    }
    
    
    $bdd = model_db_connexion();
     
     
     
    
   function  select($bdd)
   {
  $results = $bdd->query('SELECT * FROM `news`');
   }
   
   select($bdd)
?>
